import random

upper_letter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lower_letter = 'abcdefghijklmnopqrstuvwxyz'
type_enum = ('普通', '会员')
vip_count = 0  # 会员数量


def make_name():
    """
    取名字
    """
    # 首字母
    first_letter = upper_letter[random.randint(0, 25)]
    other = ''
    for _ in range(0, 7):
        other += lower_letter[random.randint(0, 25)]
    return first_letter + other


def prepare_data():
    f = open('E:/PythonBasicKnowledge/07 文件操作/原始数据.txt', 'w', encoding='UTF-8')
    f.write('ID, 姓名, 类型')
    for item in range(1, 1001):
        user_type = type_enum[random.randint(0, 1)]
        if user_type == '会员':
            global vip_count
            vip_count += 1
        f.write(F'\n{item}, {make_name()}, {user_type}')
    f.flush()


prepare_data()
print(f'🌼会员数量{vip_count}')
